<!--
 *  
 *   -04-19 17:01:04
 *   -13 14:59:11
 *   
 *    
 *   \dami\src\components\Sider.vue
-->
<template>
  <div class="sider">
    <MenuItem name="recommend" class="recommend">
      <Icon type="ios-paper" />
      你可能还喜欢
    </MenuItem>
    <Card class="item" v-for="data in datas" :key="data.name" :bordered="false">
      <!-- <div class="item-img" :style="{ 'background-color': data.imgUrl }"></div> -->

      <img :src="data.imgUrl" @click="detail(data)" class="item-img" alt="" />
      <div class="item-info" @click="detail(data)">
        <p class="item-title">{{ data.title }}</p>
        <p class="item-locate">{{ data.address }}</p>
        <p class="item-itemName">{{ data.date }}</p>
        <p class="item-price">票价： ￥{{ data.unitPrice }}</p>
      </div>
    </Card>
  </div>
</template>
  
  <script>
export default {
  name: "resultSider",
  data() {
    return {
      datas: [
        {
          title: "坚如磐石",
          imgUrl: require("../assets/banner/2.png"),
          address: "山东省济南市",
          date: "2023-4-20",
          unitPrice: 60,
        },
        {
          title: "河边的错误",
          imgUrl: require("../assets/banner/1.png"),

          address: "山东省济南市",
          date: "2023-04-19",
          unitPrice: 110,
        },
        {
          title: "一个和四个",
          imgUrl: require("../assets/banner/3.png"),

          address: "山东省济南市",
          date: "2023-04-19",
          unitPrice: 221,
        },
        {
          title: "无价之宝",
          imgUrl: require("../assets/banner/4.png"),

          address: "山东省济南市",
          date: "2023-04-19",
          unitPrice: 410,
        },
        {
          title: "唐人街探案",
          imgUrl: require("../assets/banner/5.png"),

          address: "山东省济南市",
          date: "2023-04-19",
          unitPrice: 30,
        },
      ],
    };
  },
  methods: {
    getslider: function () {
      this.$http
        .getRequest({
          api: "sider",
          data: {},
        })
        .then((res) => {
          this.datas = res.datas;
        })
        .catch((err) => {
          console.log(err);
        });
    },
    detail(item) {
      console.log(item, "item");
      localStorage.setItem("itemInfo", JSON.stringify(item));
      //   window.location.reload();

      this.$router.push({ name: "Detail" });
    },
  },
  mounted: function () {
    // this.getslider();
  },
};
</script>
  
  <style scoped>
.sider {
  margin-left: 10px;
}
.recommend {
  font-size: 18px;
}
.item {
  height: 200px;
  margin-bottom: 10px;
}
.item:hover {
  cursor: pointer;
}
.item-img {
  display: inline-block;
  width: 100px;
  height: 150px;
  border: none;
  background-color: rgb(67, 69, 204);
}
.item-info {
  display: inline-block;
}

.item-itemName,
.item-price,
.item-date,
.item-locate,
.item-title {
  width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 10px;
  font-size: 12px;
}
.item-title {
  font-size: 16px;
  font: bolder;
  margin-bottom: 40px;
}
</style>